# -*- coding:UTF-8 -*-


from utils.image_code import image_code
from django_redis import get_redis_connection
from django.http import HttpResponse


def get_image_code(request):
    if request.method == 'GET':
        code, code_image = image_code()
        # redis_cli = get_redis_connection('image_code')
        request.session['code'] = code
        print(code)
        return HttpResponse(code_image, content_type='image/png')
